# $Id: PKGBUILD 184368 2013-05-06 19:36:54Z foutrelis $
# Maintainer: Andreas Radke <andyrtr@archlinux.org>

pkgname=cups-filters
pkgver=1.0.34
pkgrel=3
pkgdesc="OpenPrinting CUPS Filters"
arch=('i686' 'x86_64')
url="http://www.linuxfoundation.org/collaborate/workgroups/openprinting"
license=('GPL')
depends=('lcms2' 'poppler>=0.22.3' 'qpdf>=4.0.0')
makedepends=('ghostscript' 'ttf-dejavu') # ttf-dejavu for make check
optdepends=('ghostscript: for non-PostScript printers to print with CUPS to convert PostScript to raster images'
	    'foomatic-db: drivers use Ghostscript to convert PostScript to a printable form directly'
	    'foomatic-db-engine: drivers use Ghostscript to convert PostScript to a printable form directly'
	    'foomatic-db-nonfree: drivers use Ghostscript to convert PostScript to a printable form directly')
backup=(etc/fonts/conf.d/99pdftoopvp.conf
        etc/cups/cups-browsed.conf)
options=(!libtool)
source=(http://www.openprinting.org/download/cups-filters/$pkgname-$pkgver.tar.gz
        cups-browsed.service)
md5sums=('fea9cad6bbb14ab0635243ed5d1d5c77'
         '4c9f97eae201798000483c4e7109e690')

build() {
  cd "$srcdir/$pkgname-$pkgver"
  ./configure --prefix=/usr  \
    --sysconfdir=/etc \
    --with-rcdir=no \
    --enable-avahi \
    --with-browseremoteprotocols=DNSSD,CUPS \
    --with-test-font-path=/usr/share/fonts/TTF/DejaVuSans.ttf
  make
}

check() {
  cd "$srcdir/$pkgname-$pkgver"
  make -j1 -k check
}

package() {
  cd "$srcdir/$pkgname-$pkgver"
  make DESTDIR="$pkgdir/" install
  # drop static lib
  rm -f ${pkgdir}/usr/lib/*.a
  
  # add missing systemd support
  install -Dm644 ${srcdir}/cups-browsed.service ${pkgdir}/usr/lib/systemd/system/cups-browsed.service
}
